<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // math.floor(math.random()*(m-n+1))+n
        let randomNum = Math.floor(Math.random()*10)+1
        while(true){
            let useInput = +prompt('请输入1~10之间的数字:')
            if(useInput>randomNum){
                alert('数字猜大了，继续猜')
            }else if(useInput<randomNum){
                alert('数字猜小了，继续猜')
            }else{
                alert('猜对了')
                break
            }
        }

    </script>
</body>
</html>